package com.ywwl.dao;

import com.ywwl.dao.provider.RoleProvider;
import com.ywwl.domain.table.SysRole;
import org.apache.ibatis.annotations.*;

import java.util.HashMap;
import java.util.List;


public interface RoleMapper {

    /**
     * 根据角色标识查询角色信息
     *
     * @param id
     * @return
     * @throws Exception
     */
    @Select("SELECT id,roleName,remark FROM sys_roles WHERE id=#{id}")
    SysRole selectByPrimaryKey(Integer id) throws Exception;

    /**
     * 根据角色信息查询角色信息
     *
     * @param hashMap
     * @return
     * @throws Exception
     */
    @SelectProvider(type = RoleProvider.class, method = "selectByWhere")
    SysRole selectByWhere(HashMap<String, String> hashMap) throws Exception;

    /**
     * 根据角色信息查询角色集合（排序）
     *
     * @param whereMap
     * @param orderMap
     * @return
     */
    @SelectProvider(type = RoleProvider.class, method = "list")
    List<SysRole> list(HashMap<String, String> whereMap, HashMap<String, String> orderMap);

    /**
     * 添加角色信息
     *
     * @param role
     * @return
     * @throws Exception
     */
    @InsertProvider(type = RoleProvider.class, method = "insert")
    Boolean insert(SysRole role) throws Exception;

    /**
     * 修改角色信息
     *
     * @param role
     * @return
     * @throws Exception
     */
    @UpdateProvider(type = RoleProvider.class, method = "update")
    Boolean update(SysRole role) throws Exception;

    /**
     * 删除角色信息
     *
     * @param id
     * @return
     * @throws Exception
     */
    @DeleteProvider(type = RoleProvider.class, method = "delete")
    Boolean delete(Integer id) throws Exception;
}
